﻿using System;
using ALinq.BBS.DataAccess;

namespace ALinq.BBS.Models
{
    public class IndexModel
    {
    }

    public class PagingModel
    {
        public PagingModel(int recordsCount, int pagesCount, int pageIndex, Func<int, string> createUrl)
        {
            this.RecordsCount = recordsCount;
            this.PagesCount = pagesCount;
            this.PageIndex = pageIndex;
            this.CreateUrl = createUrl;

            PagingSize = 10;
        }

        public PagingModel(PostList postList, Func<int, string> createUrl)
        {
            this.RecordsCount = postList.Posts.Count;
            this.PagesCount = postList.Posts.PagesCount;
            this.PageIndex = postList.Index;
            this.CreateUrl = createUrl;

            PagingSize = 10;
        }

        public int PageIndex { get; set; }

        public Func<int, string> CreateUrl { get; set; }

        public int RecordsCount { get; set; }

        public int PagesCount { get; set; }

        /// <summary>
        /// 页码显示的数量
        /// </summary>
        public int PagingSize { get; set; }
    }
}